//
//  ReadAppUpdataVC.m
//  LiteraryTune
//
//  Created by mack on 2018/11/18.
//  Copyright © 2018 cxd. All rights reserved.
//

#import "ReadAppUpdataVC.h"

@interface ReadAppUpdataVC ()

@end

@implementation ReadAppUpdataVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = YES;
    
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:self.view.bounds];
    imageV.image = [UIImage imageNamed:@"bannerMeme"];
    [self.view addSubview:imageV];
    
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(popUpAlert)
                                                 name:UIApplicationWillEnterForegroundNotification
                                               object:nil];
    
}
- (void)viewDidAppear:(BOOL)animated {
    
    [super viewDidAppear:animated];
    [self popUpAlert];
}

- (void)popUpAlert {
    
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"发现需要升级的版本，现在去更新?" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
    [alertView show];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    
    [self gotoUpdate:nil];
}
- (void)gotoUpdate:(id)sender {
    //    [];[self stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.urlStr]];
}

@end
